(function(jQuery) {
	/*公司主体放大镜JS create by pengpeng P0012*/
	
	var gridColMenu_Detail = null;

	$.MagnifierCompanyBodyUtils = {
		/**
		 * 页面初始化函数
		 */
		init : function() {
			var name = encodeURI($('#condition').val());
			var multiSelectFlag = encodeURI($('#magnifierDCPage_multiSelect').val());/*这段代码可能没用*/
			// 创建列表DataGrid
			$('#magnifierMD_companybody')
					.datagrid(
							{
								url : 'magnifier/getMagnifierCompanyBodyList.do?catch='
										+ new Date() 
										+ '&Login_SessionId='
										+ sessionId,
								method : 'get',
								title : $.i18n.prop("js.magnifier.title.companyBody"),
								iconCls : 'icon-large-smartart',
								pagination : true,
								rownumbers : true,
								striped : true,
								pageSize : 10,
								pageList : [10],
								columns : [ [{
									field : 'id',
									title : $.i18n.prop("js.magnifier.datagrid.id"),
									hidden : true,
									width : 0,
									align : 'left'
								}, {
									field : 'companyBodyCode',
									title : $.i18n.prop("js.magnifier.datagrid.code"),
									width : 200,
									align : 'left'
								}, {
									field : 'companyBodyName',
									title : $.i18n.prop("js.magnifier.datagrid.name"),
									width : 233,
									align : 'left'
								} ] ],

								onDblClickRow : function(rowIndex, rowData) {
									//向父页面赋值
									if ($('#magnifierCompanyBodyPage_code').val() != null && $('#magnifierCompanyBodyPage_code').val().length > 0) {
										$("#" + $('#magnifierCompanyBodyPage_code').val(),window.parent.document).searchbox(
												'setValue', rowData.companyBodyCode);
									}
									if ($('#magnifierCompanyBodyPage_name').val() != null && $('#magnifierCompanyBodyPage_name').val().length > 0) {
										$("#" + $('#magnifierCompanyBodyPage_name').val()).val(rowData.companyBodyName);
									}
									//关闭放大镜窗口
									$("#magnifier_window").window('close');
								},
								onLoadError: function(){
									$.LmisUtils.opLoadError();
								}
							});
		},

		/**
		 * 查询
		 */
		search : function() {
			var name = encodeURI($('#condition').val());
			$('#magnifierMD_companybody')
					.datagrid(
							{
								url : 'magnifier/getMagnifierCompanyBodyList.do?catch='
										+ new Date() 
										+ '&companyBody='
										+ name
										+ '&Login_SessionId='
										+ sessionId
							});
			
		}
	};
})(jQuery);
$.MagnifierCompanyBodyUtils.init();
